name = 'ada lovelace'
print(name.title())
name = 'Ada Lovelace'
print(name.upper())
print(name.lower())

first_name = "ada"
last_name = "lovelace"
full_name = f"{first_name} {last_name}"
print(full_name)
message = f'Hello {first_name} {last_name}'
print(message)

favorite_language = 'Python '
print(favorite_language)
print(favorite_language.rstrip())
print('----------------------------')
'''
去除字符串前后空格 
'''
favorite_language = ' Java '
print(favorite_language)
print(favorite_language.lstrip())  # 去除左边空格
print(favorite_language.rstrip())  # 去除右边空格
print(favorite_language.strip())  # 去除两边空格

print('---------------------------')
'''
删除前缀
'''
web_url = 'https://www.qq.com'
print(web_url.removeprefix('https://'))  # 删除前缀

# 示例 1：移除存在的后缀
text1 = "HelloWorld"
result1 = text1.removesuffix("World")
print(result1)

# 示例 2：移除不存在的后缀
text2 = "HelloWorld"
result2 = text2.removesuffix("Python")
print(result2)

# 示例 3：空后缀情况
text3 = "HelloWorld"
result3 = text3.removesuffix("")
print(result3)

strings = ["prefix_apple", "prefix_banana", "prefix_cherry"]
prefix = "prefix_"
new_strings = [string.removeprefix(prefix) for string in strings]
print(new_strings)
